﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CloseAllWindows
{
    /// <summary>
    /// Interaction logic for ProcessGroupControl.xaml
    /// </summary>
    public partial class ProcessGroupControl : UserControl
    {
        public string GroupName = "";
        public ProcessGroupControl()
        {
            InitializeComponent();
        }

        private void OnChangeChecked()
        {
            if (MainWindow.Instance.ProcessItemControlDic.ContainsKey(GroupName))
            {
                foreach (var item in MainWindow.Instance.ProcessItemControlDic[GroupName])
                {
                    item.ItemCheck.IsChecked = ItemCheck.IsChecked;
                }
            }
        }
        private void ItemCheck_Checked(object sender, RoutedEventArgs e)
        {
            OnChangeChecked();
        }

        private void ItemCheck_UnChecked(object sender, RoutedEventArgs e)
        {
            OnChangeChecked();
        }
    }
}
